package com.kgc.xsConsumer.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.xsConsumer.feign.SalesOrderSummaryFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/SalesOrderSummary")
@CrossOrigin
public class SalesOrderSummaryController {

    private Logger logger = LoggerFactory.getLogger(SalesOrderSummaryController.class);

    @Autowired
    private SalesOrderSummaryFeign salesOrderSummaryFeign;

    @RequestMapping("selectSummaryByCustomer")
    public ResponseMsg selectSummaryByCustomer(@RequestBody Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByCustomer map:{}", map);
        return salesOrderSummaryFeign.selectSummaryByCustomer(map);
    }

    @RequestMapping("selectSummaryByMonthTime")
    public ResponseMsg selectSummaryByMonthTime(@RequestBody Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByMonthTime map:{}", map);
        return salesOrderSummaryFeign.selectSummaryByMonthTime(map);
    }

    @RequestMapping("selectSummaryByYearTime")
    public ResponseMsg selectSummaryByYearTime(@RequestBody Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByYearTime map:{}", map);
        return salesOrderSummaryFeign.selectSummaryByYearTime(map);
    }

    @RequestMapping("getTotalSalesDataByDate")
    public ResponseMsg getTotalSalesDataByDate(){
        logger.info("SalesOrderSummaryController getTotalSalesDataByDate is start...");
        return salesOrderSummaryFeign.getTotalSalesDataByDate();
    }

    @RequestMapping("getSalesOutBoundDataByTime")
    public ResponseMsg getSalesOutBoundDataByTime(){
        logger.info("SalesOrderSummaryController getSalesOutBoundDataByTime is start...");
        return salesOrderSummaryFeign.getSalesOutBoundDataByTime();
    }

    @RequestMapping("getReceivableDataByTime")
    public ResponseMsg getReceivableDataByTime(){
        logger.info("SalesOrderSummaryController getReceivableDataByTime is start...");
        return salesOrderSummaryFeign.getReceivableDataByTime();
    }

    @RequestMapping("getSalesReturnDataByTime")
    public ResponseMsg getSalesReturnDataByTime(){
        logger.info("SalesOrderSummaryController getSalesReturnDataByTime is start...");
        return salesOrderSummaryFeign.getSalesReturnDataByTime();
    }
}
